using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;

namespace DNAide.Website.Templates.WebForms
{
	public class BaseWebForm : System.Web.UI.Page
	{
		protected override void Render(HtmlTextWriter writer)
		{
			string xhtml = string.Empty;
			StringWriter sw = new StringWriter();

			HtmlTextWriter output = new HtmlTextWriter(sw);
			base.Render(output);
			output.Close();

			xhtml = sw.ToString();
			xhtml = xhtml.Replace("href=\"~/", "href=\"" + Page.ResolveUrl("~/"));
			xhtml = xhtml.Replace("src=\"~/", "src=\"" + Page.ResolveUrl("~/"));
			xhtml = xhtml.Replace("##DownloadUrl##", ConfigurationManager.AppSettings["DownloadUrl"]);

			writer.Write(xhtml);
		}
	}
}
